home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / pmode / 386p_099 / 386power.inc < prev    next >
Encoding:
Text File  |  1994-05-03  |  3.4 KB  |  115 lines

  1. ; 386POWER INCLUDE FILE
  2. ; VIRTUAL 80x86 REGISTER IMAGE
  3. global   V86eax:dword, V86ebx:dword, V86ecx:dword, V86edx:dword
  4. global   V86esi:dword, V86edi:dword, V86ebp:dword
  5. global   V86ah:byte, V86al:byte, V86bh:byte, V86bl:byte
  6. global   V86ch:byte, V86cl:byte, V86dh:byte, V86dl:byte
  7. global   V86ax:word, V86bx:word, V86cx:word, V86dx:word
  8. global   V86si:word, V86di:word, V86bp:word
  9. global   V86ds:word, V86es:word, V86fs:word, V86gs:word
  10.  
  11. ; GLOBAL VARS
  12. global   _SelCode:word, _SelData:word, _SelZero:word, _LoMemBase:dword
  13. global   _LoMemTop:dword, _HiMemBase:dword, _HiMemTop:dword, _PSPBase:dword
  14. global   _Code16Base:dword, _Code32Base:dword
  15.  
  16. ; these two are POINTERS to the routines needed
  17. ; to set protected mode irq handlers
  18. ; call them with:
  19. ; BL = IRQ number
  20. ; EDX = offset of the routine into code32 segment
  21. global _GetIRQ:dword, _SetIRQ:dword
  22. ; similar to the get/set irq these routines enable or disable
  23. ; the IRQ LINE on the Programmable Interrupt Controller
  24. ; call them with:
  25. ; bl = IRQ number
  26. ; al = IRQ flag status (0 = enabled, 1= disabled)
  27. global _GetIRQMask:near, _SetIRQMask:near
  28.  
  29. ; 386 MANager type ( 0=VCPI, 1=DPMI)
  30. global   _386Man:byte
  31.  
  32. ; routines to allocate memory
  33. ; IN: eax= size
  34. ;
  35. ; OUT: if CARRY_FLAG clear then 
  36. ;               eax = offset of allocated block (code32 relative)
  37. ;      else
  38. ;               not enough memory available
  39. ;
  40. ; _GetLoMem tries to allocate memory into dos ram (the first 640k)
  41. ; _GetHiMem tries to allocate memory into extended ram (beyound the 1st mega)
  42. ; _GetMem   tries first dos, then extended ram
  43. global   _GetMem:near, _GetLoMem:near, _GetHiMem:near
  44.  
  45. ; terminates program and restores all interrupt handlers
  46. global   _Exit:near, 
  47.  
  48. ; THE FOLLOWING TABLE IS LOCATED IN THE CODE16 SEGMENT
  49. ; it contains the "old" interrupt handlers
  50. ; (the handlers you call when you execute INT 33h from protected mode)
  51. ; it is visible so the virtual 80x86 bimodal irq servers can
  52. ; call the "old" interrupt handlers when they chain them
  53. global   _OldInt:dword
  54.  
  55. @rlp    macro reg, ptr
  56.         mov ®,&ptr     ; Convert linear pointer to code32 pointer
  57.         sub ®,_Code32Base
  58. endm
  59.  
  60. @php    macro reg, ptr
  61.         mov ®,&ptr     ; Convert code32 pointer to linear pointer
  62.         add ®,_Code32Base
  63. endm
  64.  
  65. @outb   macro   val
  66.         mov al,&val  ; Output a byte to DX
  67.         out dx,al
  68. endm
  69.  
  70. @outw   macro   val
  71.         mov ax,&val  ; Output a word to DX
  72.         out dx,ax
  73. endm
  74.  
  75. @gif    macro
  76.         mov ax,902h  ; Get interrupt flag status
  77.         int 31h
  78. endm
  79.  
  80. @gifc   macro
  81.         mov ax,0900h ; Get interrupt flag status and clear
  82.         int 31h
  83. endm
  84.  
  85. @gifs   macro
  86.         mov ax,0901h ; Get interrupt flag status and set
  87.         int 31h
  88. endm
  89.  
  90. @gifal  macro
  91.         mov ah,09 ; Get interrupt flag status and set to AL (0=clear, 1=set)
  92.         int 31h
  93. endm
  94.  
  95. @hisize macro
  96.         mov eax,_HiMemBase
  97.         sub eax,_HiMemTop
  98. endm
  99.  
  100. @losize macro
  101.         mov eax,_LoMemBase
  102.         sub eax,_LoMemTop
  103. endm
  104.         
  105. IS_VCPI  = 0
  106. IS_DPMI  = 1
  107.                          
  108. LOWMIN           = 256      ; minimum free low memory (in K)
  109. EXTMIN           = 128      ; minimum free extended memory (in K)
  110.  
  111. STACKSIZE        = 0FFFh   ; total stack size in paragraphs (nearly 64k)
  112. STACKSLOT        = 0200h   ; stack slot space in paragraphs (8 K) this means
  113.                            ; a max. of 8 nested mode switch are allowed
  114.  
  115.